import axios from 'axios'

const baseUrl = process.env.NODE_ENV === 'development' ? 'https://55o9f99382.goho.co' : 'https://55o9f99382.goho.co'

var instance = axios.create({
  baseURL: baseUrl,
  timeout: 20000
})

// 添加头文件
instance.interceptors.request.use(
  function (config) {
    // if (localStorage.getItem('isLogin')) {
    //   //在每个请求的 headers 中添加 token 值 localStorage.getItem('token') store.state.auth.token
    //   config.headers['Authorization'] = 'Bearer ' + localStorage.getItem('isLogin')
    // }
    return config
  },
  function (error) {
    return Promise.reject(error)
  }
)

export { instance }
